package com.fenghongzhang.day007;

import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.RatingBar;

import androidx.appcompat.app.AppCompatActivity;

public class Main3Activity extends AppCompatActivity {
    private RadioGroup group;
    private RatingBar bar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        bar = (RatingBar) findViewById(R.id.bar);
        group = (RadioGroup) findViewById(R.id.group);

        Student student = new Student();
        student.setGame(true);


        student.isGame();

        group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId){
                    case R.id.yiban:
                        bar.setRating(3.0f);
                        break;
                    case R.id.henhao:
                        bar.setRating(4.0f);
                        break;
                }

            }
        });

    }
}
